package com.situ.day8;

import java.util.ArrayList;

import org.junit.Test;

import com.situ.day7.Student;

public class Demo{
	public static void main(String[] args) {
		int num = 3;
		int[] array1 = new int[3];
		Student[] array2 = new Student[3];
		//ArrayList<int> list1 = new ArrayList<>();
		ArrayList<Integer> list2 = new ArrayList<>();
	}
	
	
	@Test
	public void test1() {
		ArrayList<Integer> list = new ArrayList<>();
		list.add(2);
		list.add(12);
		for (Integer integer : list) {
			System.out.println(integer + " ");
		}
		
		// int类型最大值
		System.out.println(Integer.MAX_VALUE);
		
		// 自动拆箱和装箱
		//Integer integer = new Integer(4);
		Integer integer = 4;//自动装箱，等价于上面操作
		int i = integer.intValue();
		int num = 4;
		num = num + 2;
		integer = integer + 2;//自动拆箱 integer.intValue()
		// integer.intValue()+2 = 6
		// 得到int类型的6又赋值给Integer类型，自动装箱
		System.out.println(integer);
		
	}
	
	@Test
	public void test2() {
		String str1 = "3.14";
		double d = Double.parseDouble(str1);
		System.out.println(d);
		String str2 = "123";
		int i = Integer.parseInt(str2);
		System.out.println(i);
		Integer integer = new Integer("33");
		int num = integer.intValue();
		System.out.println(num);
	}
	
	
	@Test
	public void test34() {
		int num = 12;
		String str = num + "";// "12"
		String str1 = Integer.toString(345);
		System.out.println(str1);
		String str2 = "true";
		boolean bool = Boolean.parseBoolean(str2);
		System.out.println(bool);
	}
	
	@Test
	public void test55() {
		int num1 = 2;
		Integer num2 = 2;
		num2 = num2 + 4;
		
		num1 = num1 + num2;
		num2 = num2 + num1;
		num2 += 3;
		
		
		
	}
	
	@Test
	public void test33() {
		Studnet studnet = new Studnet();//没有给id赋值，int默认值是0
		System.out.println(studnet.getId());// null
		System.out.println(studnet.getName());// null
		studnet.setId(0);// 设置id值是0
		studnet.setName("");
		System.out.println(studnet.getId());// 0
		System.out.println(studnet.getName());// ""
	}
	
}
